package github.aquanlerou.message;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.concurrent.CountDownLatch;

/**
 * @Class Receiver
 * @Description TODO
 * @Author Aquan
 * @Date 2019.3.6 17:11
 * @Version 1.0
 **/
public class Receiver {

    private static final Logger LOGGER = LoggerFactory.getLogger(Receiver.class);
    private CountDownLatch latch;

    @Autowired
    public Receiver(CountDownLatch latch) {
        this.latch = latch;
    }

    public void receiveMessage(String message) {
        LOGGER.info("Received < " + message + " >");
        latch.countDown();
    }

}
